﻿using Microsoft.AspNetCore.Http;

namespace Enter.Dashboard.Api
{
    public static class Consts
    {
        public const string AjaxHeadersTokenKey = "token";

        public static string GetToken(this HttpContext httpContext, string headerKey = AjaxHeadersTokenKey) 
        {
            if (httpContext.Request.Headers.TryGetValue(headerKey, out var token))
            {
                return token.ToString();
            }
            return string.Empty;
        }
    }
}
